<?php

	/**
	 * Verifies bootstrapper execution to ensure file
	 * necessities, and disabling direct access
	 */
	defined('ENGINE') or exit;
	
	/**
	 * URL validation, check if supplied url
	 * is written with a correct syntax.
	 */
	function is_valid_url($url = NULL)
	{
		$url = (string) $url;
		
		if(!is_null($url))
		{			
			if(extension_loaded('filter'))
			{
				return((boolean) filter_var($url, FILTER_VALIDATE_URL));
			}
			else
			{
				if(preg_match('/^(http|https|ftp|mailto):\/\/[a-z0-9A-Z]+([\-\.]{1}[a-z0-9A-Z]+)*\.[a-zA-Z]{2,5}'.'((:[0-9]{1,5})?\/.*)?$/i', $url))
				{
					return(true);
				}
			}
		}
		
		return(false);
	}

?>